fix(ng-dev): ensure sync-module-bazel uses correct paths when executed in nested directories#3512
fix(ng-dev): ensure sync-module-bazel uses correct paths when executed in nested directories#3512alan-agius4 wants to merge 1 commit intoangular:mainfrom
Conversation
…d in nested directories The cwd was not specified which resulted in incorrect execution path.
96fff43 to
bda8af9
Compare
There was a problem hiding this comment.
Code Review
This pull request aims to fix an issue with incorrect paths when running sync-module-bazel from a nested directory. The changes correctly identify the areas that need modification (formatFiles and ChildProcess.spawnSync). However, the fix is incomplete because the rootDir variable is still initialized to the current working directory instead of the repository root. My review includes a comment with a suggestion to fully address the issue.
| ChildProcess.spawnSync('pnpm', ['bazel', 'mod', 'deps', '--lockfile_mode=update'], { | ||
| suppressErrorOnFailingExitCode: true, | ||
| cwd: rootDir, | ||
| }); |
There was a problem hiding this comment.
This change aims to fix execution from nested directories by setting cwd. However, as rootDir is initialized to process.cwd() on line 25, this change is ineffective because spawnSync already defaults to using the current working directory.
To achieve the goal of this PR, rootDir must point to the repository's root directory. This would also make the change on line 68 (using moduleBazelPath) work as intended when running from a nested directory.
A full fix would involve changing how rootDir is initialized at the start of the handler function. For example:
// At line 25
const rootDir = determineRepoBaseDirFromCwd();While this change is outside the current diff, it is essential for this PR's stated goal to be met.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The cwd was not specified which resulted in incorrect execution path.